package me.jessyan.mvparms.demo.mvp.ui.holder;

import android.util.Log;
import android.view.View;

import com.jess.arms.base.BaseHolder;

import java.util.List;

import me.jessyan.mvparms.demo.R;
import me.jessyan.mvparms.demo.mvp.ui.widget.CustomIntColorChangeTextView;

/**
 * @author DrChen
 * @Date 2019/3/5 0005.
 * qq:1414355045
 */
public class MyIntegralRecordHolder extends BaseHolder<Boolean> {
    List<Boolean> list;
    CustomIntColorChangeTextView recordTv;
    public MyIntegralRecordHolder(View itemView, List<Boolean> list) {
        super(itemView);
        this.list = list;
        recordTv = itemView.findViewById(R.id.record_tv);

    }

    @Override
    public void setData(Boolean data, int position) {
//        Log.e("tag",position +" :"+(position==list.size()-1)+":" + (position<list.size()-1 && list.get(position+1)));
        //设置最后一个记录的阴影
        if(position==list.size()-1 ||
                (position<list.size()-1 && list.get(position+1))){
            itemView.findViewById(R.id.last_shadow_cl).setVisibility(View.VISIBLE);
          setText("-300");
        }else {
            itemView.findViewById(R.id.last_shadow_cl).setVisibility(View.GONE);
            setText("+200");
        }

    }

    private void setText(String msg){
        recordTv.setTextSignIntColor(msg,"#FF4554","#7ABC5D");
    }
}
